Skip to content

Backfill veriff duplicate identity fraud#3784

Open
devkiran wants to merge 8 commits intomainfrom
backfill-veriff-duplicate-identity-fraud
Open

Backfill veriff duplicate identity fraud#3784
devkiran wants to merge 8 commits intomainfrom
backfill-veriff-duplicate-identity-fraud

Conversation

@devkiran
Copy link
Copy Markdown
Collaborator

@devkiran devkiran commented Apr 20, 2026

Summary by CodeRabbit

  • Chores
    • Added database maintenance script to process historical fraud detection data.

Re-fetches Veriff decisions for every partner with a veriffSessionId and
replays detectDuplicateIdentityFraud when risk labels are present, so
partners flagged before #3765 also get partnerDuplicateAccount fraud
events. Idempotent via hash-based dedup in createFraudEvents.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview Apr 21, 2026 0:58am

Request Review

@devkiran devkiran requested a review from steven-tey April 20, 2026 06:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65e6d42e-8fae-4cae-9412-56cd955dbc1f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backfill-veriff-duplicate-identity-fraud

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/scripts/migrations/backfill-veriff-duplicate-identity-fraud.ts`:
- Around line 74-94: The migration currently swallows per-partner errors and
exits 0; change main() to throw if the errored counter is >0 after processing so
failures surface (check the errored variable after batches and throw an Error
with context), and replace the bare main() call with main().catch(...) and
.finally(...) handlers that log the error, call process.exit(1) for failures,
and ensure Prisma disconnect is invoked (referencing main(), errored, and the
existing per-partner catch that logs partnerId/veriffSessionId).
- Around line 1-6: Move the side-effect import of dotenv-flow to run before any
modules that read env vars: place import "dotenv-flow/config" at the very top of
this file so it executes before importing detectDuplicateIdentityFraud,
fetchVeriffSessionDecision, VeriffRiskLabel/veriffRiskLabels, prisma and chunk;
this ensures module-initialization reads correct environment variables and
avoids uninitialized configuration during prisma and `@dub/utils` setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9d41f4e-251f-44da-a3f0-dc075d533858

📥 Commits

Reviewing files that changed from the base of the PR and between f2c937d and e361cfc.

📒 Files selected for processing (1)
  • apps/web/scripts/migrations/backfill-veriff-duplicate-identity-fraud.ts

Base automatically changed from remove-partnerDuplicatePayoutMethod-enum to main April 20, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant